# Topic 7g Look at different kinds of distributions # # We will want some large sets of data so we # will use gnrnd5() source("../gnrnd5.R") # a uniform distribution gnrnd5(178794127801, 498000901) # histogram hist( L1, main="Uniform", xlim=c(90,140), ylim=c(0,400), breaks=seq(90,140,5), yaxp=c(0,400,4)) abline( h=0, lty="solid", col="black") abline( h=seq(100,400,100), lty="dotted", col="darkgreen") # boxplot # 1st use summary to get the values highlighted # in the box plot s_hold <- summary(L1) # Then create a bottom label b_lab <- paste("min=", s_hold[1], " Q1=", s_hold[2], " Med=",s_hold[3], " Q3=", s_hold[5], " max=", s_hold[6]) boxplot( L1, horizontal = TRUE, ylim=c(90,140), main="Uniform", xlab=b_lab) abline( v=seq(90,140,10), lty="dotted", col="darkgreen") # # a skewed right distibution gnrnd5(145789127802, 468000931) # histogram hist( L1, main="Skewed right", xlim=c(90,140), ylim=c(0,400), breaks=seq(90,140,5), yaxp=c(0,400,4)) abline( h=0, lty="solid", col="black") abline( h=seq(100,400,100), lty="dotted", col="darkgreen") # boxplot # 1st use summary to get the values highlighted # in the box plot s_hold <- summary(L1) # Then create a bottom label b_lab <- paste("min=", s_hold[1], " Q1=", s_hold[2], " Med=",s_hold[3], " Q3=", s_hold[5], " max=", s_hold[6]) boxplot( L1, horizontal = TRUE, ylim=c(90,140), main="Skewed right", xlab=b_lab) abline( v=seq(90,140,10), lty="dotted", col="darkgreen") # # a skewed left distribution gnrnd5( 196784127803, 458000925) # histogram hist( L1, main="Skewed left", xlim=c(90,140), ylim=c(0,400), breaks=seq(90,140,5), yaxp=c(0,400,4)) abline( h=0, lty="solid", col="black") abline( h=seq(100,400,100), lty="dotted", col="darkgreen") # boxplot # 1st use summary to get the values highlighted # in the box plot s_hold <- summary(L1) # Then create a bottom label b_lab <- paste("min=", s_hold[1], " Q1=", s_hold[2], " Med=",s_hold[3], " Q3=", s_hold[5], " max=", s_hold[6]) boxplot( L1, horizontal = TRUE, ylim=c(90,140), main="Skewed left", xlab=b_lab) abline( v=seq(90,140,10), lty="dotted", col="darkgreen") # # a normal distribution gnrnd5( 149787127804, 71001131) # histogram hist( L1, main="Approximately Normal", xlim=c(90,140), ylim=c(0,400), breaks=seq(90,140,5), yaxp=c(0,400,4)) abline( h=0, lty="solid", col="black") abline( h=seq(100,400,100), lty="dotted", col="darkgreen") # boxplot # 1st use summary to get the values highlighted # in the box plot s_hold <- summary(L1) # Then create a bottom label b_lab <- paste("min=", s_hold[1], " Q1=", s_hold[2], " Med=",s_hold[3], " Q3=", s_hold[5], " max=", s_hold[6]) boxplot( L1, horizontal = TRUE, ylim=c(90,140), main="Normal", xlab=b_lab) abline( v=seq(90,140,10), lty="dotted", col="darkgreen") # # a bimodal distribution gnrnd5( 176823127805, 39001020, 51001225) hist( L1, main="Bimodal", xlim=c(90,140), ylim=c(0,400), breaks=seq(90,140,5), yaxp=c(0,400,4)) abline( h=0, lty="solid", col="black") abline( h=seq(100,400,100), lty="dotted", col="darkgreen") # boxplot # 1st use summary to get the values highlighted # in the box plot s_hold <- summary(L1) # Then create a bottom label b_lab <- paste("min=", s_hold[1], " Q1=", s_hold[2], " Med=",s_hold[3], " Q3=", s_hold[5], " max=", s_hold[6]) boxplot( L1, horizontal = TRUE, ylim=c(90,140), main="Bimodal", xlab=b_lab) abline( v=seq(90,140,10), lty="dotted", col="darkgreen") #